# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import Union, List
from pydantic import BaseModel, Field
from fastapi import Query


class DrawsRecordSearchIn(BaseModel):
    """ 绘画记录搜索参数 """
    page_no: int = Query(default=1, gt=0, description="当前页码")
    page_size: int = Query(default=15, gt=0, le=200, description="每页条数")
    engine: str = Query(..., pattern=r"^(mj|sd|doubao|dalle)$", description="绘图引擎")
    status: Union[int, str, None] = Query(default=None, description="生成状态: [0=待生成, 1=生成中, 2=成功, 3=失败]")


class DrawsRecordDetectionIn(BaseModel):
    """ 绘画记录检测参数 """
    ids: List[str] = Field(default=[], description="记录编号")


class DrawsRecordCodeIn(BaseModel):
    """ 绘画记录编号参数 """
    code: str = Field(..., min_length=1, max_length=32, description="记录编号")


"""--------------- Separator ---------------"""


class DrawsRecordsVo(BaseModel):
    """ 绘画记录列表Vo """
    code: str = Field(description="记录编号")
    engine: str = Field(description="绘图引擎: [mj, sd, dalle, doubao]")
    type: str = Field(description="绘图类型: [text2img=文生图, img2img=图生图, upscale2img=图放大, variation2img=图变换]")
    scale: str = Field(description="图片比例")
    model: str = Field(description="绘图模型")
    version: str = Field(description="版本参数")
    prompt_in: str = Field(description="输入提示词")
    prompt_en: str = Field(description="英文提示词")
    prompt_eq: str = Field(description="完整提示词")
    thumbnail: str = Field(description="缩略图地址")
    image_ref: str = Field(description="引用图地址")
    image_loc: str = Field(description="本地图地址")
    image_url: str = Field(description="绘图服务返回地址")
    image_id: str = Field(description="绘图服务图片的ID")
    task_id: str = Field(description="绘图服务任务的ID")
    use_points: int = Field(description="消耗积分")
    status: int = Field(description="生成状态: [0=等待中, 1=执行中, 2=成功, 3=失败]")
    is_free: int = Field(description="免费调用: [0=否, 1=是]")
    share_status: int = Field(description="分享广场: [0=待审, 1=审核通过, 2=审核拒绝]")
    share_result: str = Field(description="分享结果")
    fail_reason: str = Field(description="可操作动作")
    create_time: str = Field(description="创建时间")
    able_cut: bool = Field(description="一键切图")
    able_actions: List[str] = Field(description="操作动作")
    other_params: dict = Field(default={}, description="其它参数")

    class Config:
        json_schema_extra = {
            "example": {

            }
        }
